package com.we823.project.repository.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;

import com.we823.project.model.StationModel;
import com.we823.project.repository.dao.StationRepository;

@Service("stationService")
public class StationService extends AbstractBaseService<StationModel> {

	private StationRepository stationRepository;
	@Autowired
	public StationService(StationRepository stationRepository) {
		super(stationRepository);
		this.stationRepository = stationRepository;
	}
	public Map<Integer, StationModel> map() {
		List<StationModel> stationModels = findAll();
		if(stationModels!=null) {
			Map<Integer, StationModel> map = new HashMap<Integer, StationModel>();
			for (StationModel stationModel : stationModels) {
				map.put(stationModel.getId(), stationModel);
			}
			return map;
		}
		return null;
	}

}
